<?php
$screen = new BScreenService();
$screen->setUINode($uiObj);
$apps = $screen->getServiceApps();
$activeApp = Blyn::app()->getActiveServiceApp();

$items = array();
$item = array();

//array_push($items, $item);

foreach ($apps as $app) {

    $name = $app->getName();

    if ($name == 'ServiceEngine') {
        $name = 'Home';
    }
    $item['url'] = $app->getUIManager()->getUrl(array('ajaxLink' => array('name' => $name)));
    //$item['url'] = $app->getUIManager()->getUrl();
    $item['label'] = $name;
    $item['active'] = '';

    if ($app->getId() == $activeApp->getId())
        $item['active'] = 'active';

    array_push($items, $item);
}
?>
<h5 class="well-small text-error"><div class="success"><span style="font-size:16px;color:royalblue;padding-right: 10px;margin-left: -6px">Current Service:</span><?php echo Blyn::app()->getActiveService()->getDisplayName();?></div></h5>
<ul class="nav nav-tabs">
    <?php foreach ($items as $item) { ?>
        <li class=<?php echo $item['active']; ?>>
            <?php echo $item['url']; ?>
        </li>  
    <?php } ?>
</ul>

<?php
/*
  $this->widget('bootstrap.widgets.TbMenu', array(
  'type' => 'tabs', // '', 'tabs', 'pills' (or 'list')
  'stacked' => false, // whether this is a stacked menu
  'items' => $items
  ));
 * 
 */
?>
